import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter);

// 导入组件，使用懒加载
const Home = () => import('../views/Home.vue')
const Category = () => import('../views/Category.vue')
const My = () => import('../views/My.vue')
const Shopcar = () => import('../views/Shopcar.vue')


const routes = [
    {
        path: '/',
        redirect: '/home'
    },
    {
        path: '/home',
        component: Home
    },
    {
        path: '/my',
        component: My
    },
    {
        path: '/shopcar',
        component: Shopcar
    },
    {
        path: '/category',
        component: Category
    },
]

const router = new VueRouter({
    mode: 'history',
    routes
})

export default router;